﻿using FirmaKurierska.Filters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace FirmaKurierska.Controllers
{
    [InitializeSimpleMembership]
    public class HomeController : Controller
    {
        /// <summary>
        /// Przekierowuje na odpowiednią stronę po zalogowaniu
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            if (Roles.IsUserInRole("Administrator"))
            {
                return RedirectToAction("Index", "Centrale", new { Area = "Admin" });
            }
            else if (Roles.IsUserInRole("Pracownik"))
            {
                return RedirectToAction("Index", "TwojaCentrala", new { Area = "Centrala" });
            }
            else if(Roles.IsUserInRole("Kierowca" )) {
                return RedirectToAction("Index", "TwojePrzesylki", new { Area = "Kierowca" });
            }
            ViewBag.Message = "Test";

            return View();
        }   
    }
}
